//
//  AYMHomeBottomAboveView.m
//  QuickCure
//
//   Mr.LV
//

#import "AYMHomeBottomAboveView.h"
#import "AYMHomeMenuBtn.h"



@implementation AYMHomeBottomAboveView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

-(void)setupUI{

    self.distribution = UIStackViewDistributionFillEqually;
   UIButton *zlBtn = [self addChildbtnImageName:@"zl" title:@"肿瘤"];
   UIButton *xygBtn = [self addChildbtnImageName:@"xyg" title:@"心血管"];
   UIButton *sjBtn = [self addChildbtnImageName:@"sj" title:@"神经"];
    zlBtn.tag = 1;
    xygBtn.tag = 1;
    sjBtn.tag = 1;
    
    [self makeConstraints:^(MASConstraintMaker *make) {
       
        make.height.equalTo(self.btn);
    }];
    
}

-(UIButton *)addChildbtnImageName:(NSString *)imageName title:(NSString *)btnTitle{

    AYMHomeMenuBtn *btn = [[AYMHomeMenuBtn alloc]init];
    self.btn = btn;
    
    [btn addTarget:self action:@selector(didBtn:) forControlEvents:UIControlEventTouchUpInside];


    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [btn setTitle:btnTitle forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    [self addArrangedSubview:btn];
    return btn;

}

//点击首页底部6个按钮的方法

-(void)didBtn:(UIButton *)button{
    
    NSDictionary *dict = @{@"tet":button.titleLabel.text};
    
    [[NSNotificationCenter defaultCenter] postNotificationName:@"didButton" object:nil userInfo:dict];
    
    
}

@end
